home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / Partition Logic 0.61 / partlogic-0.61.iso / system / headers / sys / window.h < prev   
Encoding:
C/C++ Source or Header  |  2006-01-31  |  6.3 KB  |  213 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2006 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  window.h
  20. //
  21.  
  22. // This file describes things needed for interaction with the kernel's
  23. // window manager and the Visopsys GUI.
  24.  
  25. #if !defined(_WINDOW_H)
  26.  
  27. #include <sys/image.h>
  28. #include <sys/progress.h>
  29. #include <sys/stream.h>
  30.  
  31. #ifndef _X_
  32. #define _X_
  33. #endif
  34.  
  35. // Window events/masks.  This first batch are "tier 2" events, produced by
  36. // windows, widgets, etc. to indicate that some more abstract thing has
  37. // happened.
  38. #define EVENT_MASK_WINDOW        0xF000
  39. #define EVENT_WINDOW_RESIZE      0x4000
  40. #define EVENT_WINDOW_CLOSE       0x2000
  41. #define EVENT_WINDOW_MINIMIZE    0x1000
  42. #define EVENT_SELECTION          0x0400
  43. // And these are "tier 1" events, produced by direct actions of the user.
  44. #define EVENT_MASK_KEY           0x0300
  45. #define EVENT_KEY_UP             0x0200
  46. #define EVENT_KEY_DOWN           0x0100
  47. #define EVENT_MASK_MOUSE         0x00FF
  48. #define EVENT_MOUSE_DRAG         0x0080
  49. #define EVENT_MOUSE_MOVE         0x0040
  50. #define EVENT_MOUSE_RIGHTUP      0x0020
  51. #define EVENT_MOUSE_RIGHTDOWN    0x0010
  52. #define EVENT_MOUSE_MIDDLEUP     0x0008
  53. #define EVENT_MOUSE_MIDDLEDOWN   0x0004
  54. #define EVENT_MOUSE_LEFTUP       0x0002
  55. #define EVENT_MOUSE_LEFTDOWN     0x0001
  56.  
  57. // The maximum numbers of window things
  58. #define WINDOW_MAXWINDOWS        256
  59. #define WINDOW_MAX_EVENTS        512
  60. #define WINDOW_MAX_TITLE_LENGTH  80
  61. #define WINDOW_MAX_COMPONENTS    256
  62. #define WINDOW_MAX_LABEL_LENGTH  80
  63. #define WINDOW_MAX_LISTITEMS     64
  64. #define WINDOW_MAX_MENUS         16
  65.  
  66. // Flags for file browsing widgets/dialogs.
  67. #define WINFILEBROWSE_CAN_CD     0x01
  68. #define WINFILEBROWSE_CAN_DEL    0x02
  69. #define WINFILEBROWSE_ALL        (WINFILEBROWSE_CAN_CD | WINFILEBROWSE_CAN_DEL)
  70.  
  71. // Some image file names for dialog boxes
  72. #define INFOIMAGE_NAME           "/system/icons/infoicon.bmp"
  73. #define ERRORIMAGE_NAME          "/system/icons/bangicon.bmp"
  74. #define QUESTIMAGE_NAME          "/system/icons/questicon.bmp"
  75. #define WAITIMAGE_NAME           "/system/mouse/mousebsy.bmp"
  76.  
  77. // An "object key".  Really a pointer to an object in kernel memory, but
  78. // of course not usable by applications other than as a reference
  79. typedef void * objectKey;
  80.  
  81. // These describe the X orientation and Y orientation of a component,
  82. // respectively, within its grid cell
  83.  
  84. typedef enum {
  85.   orient_left, orient_center, orient_right
  86. }  componentXOrientation;
  87.  
  88. typedef enum {
  89.   orient_top, orient_middle, orient_bottom
  90. }  componentYOrientation;
  91.  
  92. // This structure is needed to describe parameters consistent to all
  93. // window components
  94. typedef struct {
  95.   int gridX;
  96.   int gridY;
  97.   int gridWidth;
  98.   int gridHeight;
  99.   int padLeft;
  100.   int padRight;
  101.   int padTop;
  102.   int padBottom;
  103.   componentXOrientation orientationX;
  104.   componentYOrientation orientationY;
  105.   int fixedWidth;
  106.   int fixedHeight;
  107.   int hasBorder;
  108.   int stickyFocus;
  109.   int useDefaultForeground;
  110.   color foreground;
  111.   int useDefaultBackground;
  112.   color background;
  113.   objectKey font;
  114.  
  115. } componentParameters;
  116.  
  117. // A structure for containing various types of window events.
  118. typedef struct {
  119.   unsigned type;
  120.   int xPosition;
  121.   int yPosition;
  122.   unsigned key;
  123.  
  124. } windowEvent;
  125.  
  126. // A structure for a queue of window events as a stream.
  127. typedef struct {
  128.   objectKey component;
  129.   volatile stream s;
  130.  
  131. } windowEventStream;
  132.  
  133. // Types of drawing operations
  134. typedef enum {
  135.   draw_pixel, draw_line, draw_rect, draw_oval, draw_image, draw_text
  136. } drawOperation;
  137.  
  138. // Parameters for any drawing operations
  139. typedef struct {
  140.   drawOperation operation;
  141.   drawMode mode;
  142.   color foreground;
  143.   color background;
  144.   int xCoord1;
  145.   int yCoord1;
  146.   int xCoord2;
  147.   int yCoord2;
  148.   unsigned width;
  149.   unsigned height;
  150.   int thickness;
  151.   int fill;
  152.   objectKey font;
  153.   void *data;
  154.  
  155. } windowDrawParameters;
  156.  
  157. // Types of scroll bars
  158. typedef enum {
  159.   scrollbar_vertical, scrollbar_horizontal
  160. } scrollBarType;
  161.  
  162. // A structure for specifying display percentage and display position
  163. // in scroll bar components
  164. typedef struct {
  165.   unsigned displayPercent;
  166.   unsigned positionPercent;
  167.  
  168. } scrollBarState;
  169.  
  170. // Types of window list displays
  171. typedef enum {
  172.   windowlist_textonly, windowlist_icononly
  173. } windowListType;
  174.  
  175. typedef struct {
  176.   char text[WINDOW_MAX_LABEL_LENGTH];
  177.   image iconImage;
  178.  
  179. } listItemParameters;
  180.  
  181. void windowCenterDialog(objectKey, objectKey);
  182. int windowClearEventHandler(objectKey);
  183. int windowClearEventHandlers(void);
  184. int windowDestroyFileList(objectKey);
  185. void windowGuiRun(void);
  186. void windowGuiStop(void);
  187. int windowGuiThread(void);
  188. int windowGuiThreadPid(void);
  189. objectKey windowNewBannerDialog(objectKey, const char *, const char *);
  190. int windowNewChoiceDialog(objectKey, const char *, const char *, char *[],
  191.               int, int);
  192. int windowNewColorDialog(objectKey, color *);
  193. int windowNewErrorDialog(objectKey, const char *, const char *);
  194. int windowNewFileDialog(objectKey, const char *, const char *, const char *,
  195.             char *, unsigned);
  196. objectKey windowNewFileList(objectKey, windowListType, int, int, const char *,
  197.                 int, void *, componentParameters *);
  198. int windowNewInfoDialog(objectKey, const char *, const char *);
  199. int windowNewPasswordDialog(objectKey, const char *, const char *, int,
  200.                 char *);
  201. objectKey windowNewProgressDialog(objectKey, const char *, progress *);
  202. int windowNewPromptDialog(objectKey, const char *, const char *, int, int,
  203.               char *);
  204. int windowNewQueryDialog(objectKey, const char *, const char *);
  205. int windowNewRadioDialog(objectKey, const char *, const char *, char *[],
  206.              int, int);
  207. int windowProgressDialogDestroy(objectKey);
  208. int windowRegisterEventHandler(objectKey, void (*)(objectKey, windowEvent *));
  209. int windowUpdateFileList(objectKey, const char *);
  210.  
  211. #define _WINDOW_H
  212. #endif
  213.